<template>
<div>
  <button @click="isShow=!isShow">显示/隐藏</button>
  <transition-group name="introduce">
    <h1 v-show="isShow" key="1" class="hello">你好啊！</h1>
    <h1 v-show="!isShow" key="2" class="name">张三</h1>
  </transition-group>
</div>
</template>

<script>
  export default {
    name: "MoreTransition",
    data(){
        return{
          isShow:true
        }
    }

  }
</script>

<style scoped>
.hello{
  background-color: orange;
}
.name{
  background-color: pink;
}
/* 进入的起点，离开的终点 */
.introduce-enter,.introduce-leave-to{
  transform: translateX(-100%);
}
/* 进入的终点，离开的起点 */
.introduce-enter-to,introduce-leave{
  transform: translateX(0);
}
.introduce-enter-active,.introduce-leave-active{
  transition: 2s linear;
}
</style>
